home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Bombardier_PC / BSCRIPTS.CST / 00093_Script_knob < prev    next >
Text File  |  1999-04-25  |  5KB  |  160 lines

  1. -- ⌐ 1998 @radical.media, inc. & Concurrent New Media Group, L.L.C.
  2. -- Developed for Bombardier, Inc.
  3. --
  4. -- All programming developed by: 
  5. -- Robert Fabricant, Valerie Valoueva, Ossi Shaked, 
  6. -- Henry Sauvageot, Chris Howell & Chris Girand
  7. --
  8. -- Use of this code by parties other than @radical.media, inc. or their
  9. --agents 
  10. -- without the express written consent of @radical.media, inc. AND Concurrent 
  11. -- New Media Group, L.L.C. is strictly prohibited.
  12. ------------------------------------------------------
  13.  
  14. property mySprite, myName, myHilite, myBoundary, myLoc, myBoundLoc, selected, myType, lastSelected, myGroup
  15.  
  16. global lastSub
  17.  
  18. on new me
  19.   global menuController
  20.   
  21.   set mySprite = the spriteNum of me
  22.   set myLoc = the loc of sprite mySprite
  23.   set myName = the name of member the member of sprite mySprite
  24.   set myHilite = myName&"-close"
  25.   set selected = 0
  26.   puppetSprite mySprite, true
  27.   set the loc of sprite mySprite = point(-1000, -1000)
  28.   set scriptNum = the scriptNum of sprite mySprite
  29.   set myType = the name of member scriptNum
  30.   register menuController, me, myName
  31.   set coverSprite = getSpriteNumFromMemberName ("anchor")
  32.   return me 
  33. end
  34.  
  35.  
  36. on heresYourGroup me, theGroup
  37.   set myGroup = theGroup
  38. end
  39.  
  40. on setLastSelected me, theLastSelObj
  41.   set lastSelected = theLastSelObj
  42. end
  43.  
  44. on getType me
  45.   return myType
  46. end
  47.  
  48. --Set up  a subcategory menu's background sprite
  49. on setSprite me, theSprite
  50.   set myBoundary = theSprite
  51.   set myBoundLoc = the loc of sprite myBoundary
  52.   puppetSprite myBoundary, true
  53.   set the loc of sprite myBoundary = point(-1000, -1000)
  54. end
  55.  
  56. on deselect me
  57.   repeat with i = 1 to count(myGroup)
  58.     set teamMate = getat(myGroup, i)
  59.     disable teamMate
  60.   end repeat
  61. end
  62.  
  63. on disable me
  64.   set selected = 0
  65.   set the member of sprite mySprite = member myName
  66.   set faraway = point(-1000,-1000)
  67.   set the loc of sprite myBoundary = faraway
  68.   set the loc of sprite mySprite = faraway
  69. end
  70.  
  71. --Clear previously selected subcategory
  72. on deleteSub me
  73.   set lastSub = void
  74. end
  75.  
  76. on mouseUp me
  77.   --  IWasSelected lastSelected, me
  78.   if selected then--clicked to fold up the subcategory menu
  79.     set selected = 0
  80.     set the loc of sprite myBoundary = point(-1000,-1000)
  81.     set the member of sprite mySprite = member myName
  82.     repeat with i = 1 to count(myGroup)
  83.       set teamMate = getat(myGroup, i)
  84.       set hisType = getType(teamMate)
  85.       --      Make sure that when a subcategory menu is closed clickin on
  86.       --      the category just reopens it,instead of taking 
  87.       --      you to category section 
  88.       if hisType = "category" then
  89.         setCatEnable teamMate, FALSE
  90.       end if
  91.       
  92.       hideYourSelf teamMate
  93.     end repeat
  94.   else --clicked to open up the subcategory menu
  95.     set selected = 1
  96.     set the member of sprite mySprite = member myHilite
  97.     set the loc of sprite myBoundary = myBoundLoc
  98.     
  99.     repeat with i = 1 to count(myGroup)
  100.       set teamMate = getat(myGroup, i)
  101.       set hisType = getType(teamMate)
  102.       
  103.       --      Make sure that when a subcategory menu is open clickin on
  104.       --      the category will take you to category section 
  105.       if hisType = "category" then
  106.         setCatEnable teamMate, TRUE
  107.       end if
  108.       
  109.       showYourSelf teamMate
  110.       
  111.     end repeat
  112.   end if
  113.   if not voidP(lastSub) then
  114.     reset lastSub --hilite currently selected subcategory
  115.   end if
  116.   puppetsound 3, "mouse5"
  117. end
  118.  
  119.  
  120. -- hide and show yourselves are called by the knob script itself to make its folks (category and subs) either be visible or not visible.
  121. on hideYourSelf me
  122.   set faraway = point(-1000,-1000)
  123.   set the loc of sprite myBoundary = faraway
  124.   set the member of sprite mySprite = member myName
  125.   set the loc of sprite mySprite = myLoc
  126.   set selected = 0
  127. end
  128.  
  129. on showYourSelf me
  130.   set selected = 1
  131.   set the loc of sprite myBoundary = myBoundLoc
  132.   set the loc of sprite mySprite = myLoc
  133.   set the member of sprite mySprite = member myHilite
  134. end
  135.  
  136.  
  137. -- the 2 rollover handlers
  138. on mouseEnter me
  139.   if not selected then
  140.     set the member of sprite mySprite = member myHilite
  141.   end if
  142. end
  143.  
  144. on mouseLeave me
  145.   if not selected then
  146.     set the member of sprite mySprite = member myName
  147.   end if
  148. end
  149.  
  150.  
  151. on setSubCat me, theSub
  152.   set lastSub = theSub
  153. end
  154.  
  155. -- not called so far in this application but necessary to call if the "behaviour lines" for the submenus are ever broken.
  156. on endPuppeting me
  157.   puppetSprite mySprite, false
  158.   puppetSprite myBoundary, false
  159. end
  160.